home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
misc
/
math
/
MathFX_src.lha
/
strpos.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-20
|
487b
|
20 lines
/* Searches string str for first occurence of character chr. If found */
/* the position of the character in the string is returned (the first */
/* character has position 0). If the character is not found a -1 is */
/* returned. */
#include "mathfx.h"
#include <stdio.h> /* Needed to define NULL */
#include <string.h>
int strpos(str,chr)
char *str,chr;
{
char *temp;
if ( (temp = strchr(str,chr)) != NULL)
return(temp - str);
else
return(-1);
}